﻿using Accessibility;
using Prism.Commands;
using Prism.Ioc;
using Prism.Mvvm;
using Prism.Regions;
using SanmaoSystem.Views;
using System;
using System.Linq.Expressions;
using System.Windows;

namespace SanmaoSystem.ViewModels
{
    public class MainWindowViewModel : BindableBase
    {

       
        private string _title = "Prism Application";
        private readonly IRegionManager _regionManager;
        //定义切换页面的command
        private DelegateCommand _switch;
        public DelegateCommand<string> Switch { get => new DelegateCommand<string>(Goto); }
        //定义导航
        
        public string Title
        {   
            get { return _title; }
            set { SetProperty(ref _title, value); }
        }
        
        public MainWindowViewModel(IRegionManager regionManager)
        {
            _regionManager = regionManager;
            //通过ContentRegion管理导航默认初始页面ContactView
           _regionManager.RegisterViewWithRegion("ContentRegion", typeof(Charts));
        }

        public void Goto(string page)
        {    

            _regionManager.RequestNavigate("ContentRegion", page);
        }

    
    }
}
